﻿var lxParMenu=new Array; //所有的父菜单
var lxSubMenu=new Array;//所有的子菜单
var loTemp=null;//暂存上一次操作的菜单
function showSubMenu(){	
	if(loTemp!=null){
		 lxSubMenu[loTemp.num].style.display="none";
		 loTemp.className="menu_bg";
	}
	this.className="menu_bg_down";
	lxSubMenu[this.num].style.display="";
	loTemp=this;	
}
function changeStyle(){
	this.className="menu_bg_over";	
}
function changeStyle2(){
	if(this!=loTemp)	this.className="menu_bg";	
  else this.className="menu_bg_down";	
}
onload=function(){
//QQMenu  
	var lxMenu=document.getElementsByTagName("td");
	for (var i=0; i<lxMenu.length; i++){
		if (lxMenu[i].className=="menu_bg"){ 
    		lxParMenu[lxParMenu.length]=lxMenu[i];
		}
		if (lxMenu[i].className=="subMenu_bg"){ 
			lxSubMenu[lxSubMenu.length]=lxMenu[i];			
			lxMenu[i].style.display="none";
		}	
	}	
	for (var i=0; i<lxParMenu.length; i++){
		lxParMenu[i].num=i;
		lxParMenu[i].onclick=showSubMenu;
		lxParMenu[i].onmouseover=changeStyle;	
		lxParMenu[i].onmouseout=changeStyle2;				
	}
	//	lxParMenu[0].click(); //初始化第一个菜单打开
	if(lxParMenu.length > 0){
		lxParMenu[0].className="menu_bg_down";
		lxSubMenu[0].style.display="";
		loTemp=lxParMenu[0];
	}
	
}
